cmake_minimum_required(VERSION 3.16)
project(rsa2048_demo C)

add_executable(rsa2048_demo rsa2048_sign_verify.c)

# 头文件：优先用仓库内 include，其次系统安装到 /usr/local/include
target_include_directories(rsa2048_demo PRIVATE
    ${CMAKE_SOURCE_DIR}/../../include
    /usr/local/include
)

# 库名与组件同名（build_sdv.sh 或安装到 /usr/local/lib 后都能找到）
# 若已存在同名 CMake target，直接链接；否则退化为 -l 方式
if (TARGET hitls_crypto AND TARGET hitls_bsl)
  target_link_libraries(rsa2048_demo PRIVATE hitls_crypto hitls_bsl)
else()
  link_directories(/usr/local/lib)
  target_link_libraries(rsa2048_demo PRIVATE hitls_crypto hitls_bsl)
endif()
